package com.xt.purchasingsystem.config;

import com.xt.purchasingsystem.utils.IdWorker;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//import org.redisson.Redisson;
//import org.redisson.api.RedissonClient;
//import org.redisson.config.Config;
//import util.IdWorker;

/**
 * @author: 老姚
 * Date:  2020/4/9 14:03
 */
@Configuration
public class MyConfig {
    @Bean
    public IdWorker idWorker() {
        return new IdWorker();
    }

    @Bean
    public RedissonClient redissonClient(){
        Config config = new Config();
        // 可以用"rediss://"来启用SSL连接
        config.useSingleServer().setAddress("127.0.0.1:6379");
        return Redisson.create(config);
    }

}
